Release 10.1A: OpenEdge Development:
AppBuilder
Applying SmartObject layouts at run time
You can reliably affect the layout of a SmartObject at run time in two ways:
Thus, you can set the initial SmartObject layout and change it as often as you like at run time.
Setting the initial layout
You can dynamically set the initial layout for your SmartObjects by creating a local
createObjects()event procedure in the SmartContainer that parents the SmartObjects:
![]()
The code after the
Note: Setting a property for a SmartObject that does not recognize the specified property has no effect. In this case, only SmartDataViewers and SmartDataBrowsers respond to the setting ofRUNSUPERstatement is what you might add to the localcreateObjects()procedure. This code finds all of the SmartObjects in the SmartContainer (SmartObjects that haveContainer-Targetlinks to this container). Next, it returns each link handle (the procedure handle for each SmartObject) and sets theObjectLayoutproperty for the associated SmartObject.ObjectLayout.The
p-layoutidentifier in this example represents a character-string input parameter to the SmartContainer that holds the initial layout value. This assumes that the SmartContainer is called from some other procedure, perhaps with the actualp-layoutvalue determined at run time.Note that the initial setting of ObjectLayout occurs after the ADM
createObjects()procedure executes. Thus, the SmartContainer changes all the SmartObject instance settings of ObjectLayout after the SmartContainer creates its SmartObjects but before it initializes them (usinginitializeObject()).Changing layouts
You can change the layout of a SmartObject with multiple layouts at any time after initialization. For example, you might do this in a user interface trigger that explicitly changes the layout when the user clicks on a button, or in response to an expression value that determines what layout a particular user is permitted to see (for example, a security key). You might have a series of expressions in a
CASEstatement that sets a varying layout according to a variety of criteria.In all of these cases you execute the following code, where
so-handleis your SmartObject procedure handle andchosen-layoutis the name that you have assigned to the alternate layout to be applied:
Thus, for the Balance button shown in Figure B–8:, you can create a trigger like this:
Executing this code immediately redisplays the layout for the SmartObject specified by the h_v_cust handle . This code can execute anywhere inside or outside of the SmartObject as long as it occurs after SmartObject initialization and while the SmartObject is still instantiated.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |